package easy;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/2/26 18:21
 */
public class TwoSum {
    private class Solution {
        public int[] twoSum(int[] nums, int target) {
            for (int i = 0; i < nums.length; i++) {
                int another = target - nums[i];
                for (int j = i + 1; j < nums.length; j++) {
                    if (nums[j] == another) {
                        return new int[]{i, j};
                    }
                }
            }
            throw new IllegalArgumentException("No two sum solution");
        }
    }
}
